#define GPFCON (*(volatile unsigned long *)0x56000050)
#define GPFDAT (*(volatile unsigned long *)0x56000054)

void delay(volatile int d)
{
    while (d--)
        ;
}

int main(void)
{

    int val = 0; /* val: ob000 , bb111*/
    int tmp;

    /* 设置GPFCON 让 GPF4/5/6 配置为输出引脚 */
    GPFCON &= ~((3 << 8) | (3 << 10) | (3 << 12));
    GPFCON |= ((1 << 8) | (1 << 10) | (1 << 12));

    while (1)
    {
        tmp = ~val;
        tmp &= 7;

        GPFDAT &= ~(7 << 4);
        GPFDAT |= (tmp << 4);

        delay(100000);
        
        val++;
        if(val == 8)
        {
            val = 0;
        }

    }

    return 0;
}